# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=iso-codes
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.15.0
pkgrel=1
pkgdesc="Lists of the country, language, and currency names (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('spdx:LGPL-2.1-or-later')
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools" "${MINGW_PACKAGE_PREFIX}-python")
url="https://salsa.debian.org/iso-codes-team/iso-codes"
source=(https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/v${pkgver}/iso-codes-v${pkgver}.tar.gz)
sha256sums=('b83b54b9d7dd6eb877380b3ec46f370b05daf2cbfa131c612f03598d654c0ef8')

prepare() {
  cd ${_realname}-v${pkgver}
  autoreconf -fi
}

build() {
  mkdir -p "${srcdir}"/build-${MSYSTEM} && cd "${srcdir}"/build-${MSYSTEM}

  ../${_realname}-v${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}

  make
}

package() {
  cd "${srcdir}"/build-${MSYSTEM}
  make DESTDIR="${pkgdir}" pkgconfigdir=${MINGW_PREFIX}/lib/pkgconfig install
  install -Dm644 "${srcdir}/${_realname}-v${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
